package leetcode.数组;

public class 旋转数组 {
    public static void main(String[] args) {
        int[] nums = {1, 2, 3, 4, 5, 6, 7};
        int k = 3;

        System.out.print("[");
        for (int i = 0; i < nums.length; i++) {
            if (i == nums.length - 1) {
                System.out.print(nums[i - nums.length + k]);
            } else if (i >= nums.length - k) {
                System.out.print(nums[i - nums.length + k] + ",");
            } else {
                System.out.print(nums[i + k] + ",");
            }
        }
        System.out.print("]");

    }
}
